//
//  MeFeedbackViewController.m
//  DBAChain
//
//  Created by Mxionlly on 2018/9/25.
//  Copyright © 2018年 Evan. All rights reserved.
//

#import "MeFeedbackViewController.h"
#import "taskUserManagerService.h"

@interface MeFeedbackViewController ()
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layoutToHead;
@property (weak, nonatomic) IBOutlet UITextView *txtDes;

@end

@implementation MeFeedbackViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.title =@"反馈";
    if (@available(iOS 11.0, *)) {
        self.layoutToHead.constant = 40;
    } else {
        self.layoutToHead.constant = 60;
    }
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self setBlackStatus:YES];
    if (@available(iOS 11.0, *)) {
        UIScrollView.appearance.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAlways;
    } else {
        self.automaticallyAdjustsScrollViewInsets = NO;
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)btnSubmit:(id)sender {
    [self.view endEditing:YES];
    if (![Check checkLenght:self.txtDes.text]) {
        [DKProgressHUD showErrorWithStatus:@"请输入反馈内容"];
        return;
    }
    NSMutableDictionary *dict = [NSMutableDictionary new];
    [dict setField:self.txtDes.text value:@"content"];
    [taskUserManagerService getFeedback:dict success:^(BaseModel *response, BOOL success) {
        if (success) {
            [DKProgressHUD showSuccessWithStatus:@"反馈成功"];
            [self.navigationController popViewControllerAnimated:YES];
        }else{
            [DKProgressHUD showErrorWithStatus:response.statusDesc];
            return;
        }
    } failture:^(NSError *error, NSString *strDescription) {
        NSString *strErr = [error.userInfo objectForKey:@"NSLocalizedDescription"];
        [DKProgressHUD showErrorWithStatus:strErr];
    }];
}





@end
